package com.zygh.policeasset.mapper;

import com.zygh.policeasset.pojo.PurchaseCodeInfo;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

@Mapper
/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/mapper/PurchaseQrCodeInfoMapper.class */
public interface PurchaseQrCodeInfoMapper {
    @Insert({"insert into purchase_code_info(qr_code,name,address,management_unit,purchase_code_generated_id) values(#{qrCode},#{name},#{address},#{managementUnit},#{purchaseCodeGeneratedId})"})
    Integer add(PurchaseCodeInfo purchaseCodeInfo);

    @Select({"<script>select * from purchase_code_info  " +
            "<where><if test='purchaseCodeGeneratedId != null '> purchase_code_generated_id=#{purchaseCodeGeneratedId} </if>" +
            "</where></script>"})
    @Results({@Result(property = "qrCode", column = "qr_code"), @Result(property = "managementUnit", column = "management_unit"), @Result(property = "purchaseCodeGeneratedId", column = "purchase_code_generated_id")})
    List<PurchaseCodeInfo> selectListById(Integer num);

    @Delete({"delete from purchase_code_info where purchase_code_generated_id = #{id}"})
    Integer deleteByqrCodeGeneratedId(Integer num);

    @Delete({"delete from purchase_code_info where id = #{id}"})
    Integer deleteById(Integer num);

    @Select({"select count(*) from qr_code_info where qr_code_generated_id is null and type = 1"})
    Integer remainCount();
}